<template>
  <div>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item to="/" v-if="route.path !== '/'"
        >首页</el-breadcrumb-item
      >
      <el-breadcrumb-item
        v-for="(item) in navArray"
        :key="item.path"
        :to="{ path: item.path }"
      >
        {{ item.meta.title }}
      </el-breadcrumb-item>
    </el-breadcrumb>
  </div>
</template>
<script lang="ts" setup>
import { useRoute, useRouter } from "vue-router";
import { watch, ref, onMounted } from "vue";

const navArray = ref([]);
const route = useRoute();
const router = useRouter();

watch(
  // 监听路由记录
  () => route.matched,
  (newValue) => {

    navArray.value = newValue;
  }
);
</script>
